const {
    Sequelize,DataTypes 
} = require('sequelize');

const sequelize = new Sequelize('db1', 'root', 'vzo2ebs63k', {
    host: 'localhost',
    dialect: 'mysql' /* one of 'mysql' | 'mariadb' | 'postgres' | 'mssql' */
})

/* try {
    await sequelize.authenticate();
    console.log('Connection has been established successfully.');
} catch (error) {
    console.error('Unable to connect to the database:', error);
}
 */

// model
const table1 = sequelize.define('table2', {
    // Model attributes are defined here
    a: {
        type: DataTypes.INTEGER,
        allowNull: false
    },
    b: {
        type: DataTypes.INTEGER
        // allowNull defaults to true
    }
}, {
    // Other model options go here
    // tableName:'table1',
    freezeTableName: true,
    timestamps: false,
    indexes:[]
});

(async ()=>{
    await table1.sync();

    let aa =await table1.findAll({
        attributes: [
          'id', 'a','b'
        ]
      });
    let aaa  = table1.create({a:23,b:32})



})()


setInterval(() => {
    
}, 2000);
